//
//  DNKUdpRequestManager.h
//  XiangJia
//
//  Created by user on 16/7/26.
//  Copyright © 2016年 Dnake. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^UdpSendFailureBlock) (NSString *message);
typedef void(^UdpSendSuccessBlock) (NSData *data, NSData *address, NSInteger tag);

@interface DNKUdpRequestManager : NSObject
 

+ (DNKUdpRequestManager *)shareUdpManager;


- (void)initWithPort:(NSInteger)port;

/**
 发送广播包数据

 @param data 数据发送
 */
- (void)sendUdpWithData:(NSData *)data toIp:(NSString *)ip port:(NSInteger)port Timeout:(NSInteger)timeout tag:(NSInteger)tag;

/**
 发送UDP数据
 
 @param data 数据发送
 */
- (void)sendUdpBroadData:(NSData *)data port:(NSInteger)port Timeout:(NSInteger)timeout tag:(NSInteger)tag;


- (void)CallMessageSuccessBlock:(UdpSendSuccessBlock)successBlock
                   failureBlock:(UdpSendFailureBlock)failuerBlock;


- (void)connectBoardPort;

- (void)coloseUDP;

- (NSString *)hostFromAddress:(NSData *)address;

@end
